package com.hdax.dmw.scheduler.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hdax.dmw.common.utils.Result;
import com.hdax.dmw.common.utils.ResultGenerator;
import com.hdax.dmw.entity.scheduler.Scheduler;
import com.hdax.dmw.scheduler.dtos.TimePlanDto;
import com.hdax.dmw.scheduler.mapstruct.TimePlanDtoMapper;
import com.hdax.dmw.scheduler.service.SchedulerService;
import com.hdax.dmw.scheduler.mappers.SchedulerMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author guoyisha
* @description 针对表【dm_scheduler(节目排期表)】的数据库操作Service实现
* @createDate 2023-07-24 14:56:40
*/
@Service
public class SchedulerServiceImpl extends ServiceImpl<SchedulerMapper, Scheduler>
    implements SchedulerService{

    @Autowired
    private TimePlanDtoMapper timePlanDtoMapper;
    @Override
    public Result<List<TimePlanDto>> getTimePlan(Long itemId) {
        List<Scheduler> schedulers = list(new QueryWrapper<Scheduler>().eq("itemId", itemId));
        List<TimePlanDto> dtos = timePlanDtoMapper.toTargetList(schedulers);
        return ResultGenerator.genSuccessResult(dtos);
    }
}




